import request from '@/utils/request'

// 查询位置列表
export function listLocation(query) {
  return request({
    url: '/apartment/location/list',
    method: 'get',
    params: query
  })
}
// 获取省份列表
// 查询省份列表
export function listProvince() {
  return request({
    url: '/apartment/location/provinces',
    method: 'get'
  })
}

// 查询城市列表
export function listCity(provinceId) {
  return request({
    url: '/apartment/location/cities',
    method: 'get',
    params: { provinceId }
  })
}

// 查询区域列表
export function listArea(cityId) {
  return request({
    url: '/apartment/location/areas',
    method: 'get',
    params: { cityId }
  })
}

// 查询位置详细
export function getLocation(locationId) {
  return request({
    url: '/apartment/location/' + locationId,
    method: 'get'
  })
}

// 新增位置
export function addLocation(data) {
  return request({
    url: '/apartment/location',
    method: 'post',
    data: data
  })
}

// 修改位置
export function updateLocation(data) {
  return request({
    url: '/apartment/location',
    method: 'put',
    data: data
  })
}

// 删除位置
export function delLocation(locationId) {
  return request({
    url: '/apartment/location/' + locationId,
    method: 'delete'
  })
}

